
export function deepCopy(target){
    if(typeof target == 'object'){
        const result = Array.isArray(target)?[]:{}
        for(const key in target){
            if(typeof target[key] == 'object'){
                result[key] = deepCopy(target[key])
            }else{
                result[key] = target[key]
            }
        }

        return result
    }

    return target
}

export function throttle(fn,delay = 100){
    let timer = null

    return function(...args){
         if(timer) return 
         timer = setTimeout(()=>{
             clearTimeout(timer)
             timer = null
              fn.apply(this,[...args])
         },delay)
    }
}

